package cn.xfdzx.android.apps.shop.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.bean.SelectAddressBeen;

/**
 * @author gzk
 * @date 2020/3/28 0028
 * description：时间天数
 */
public class SelectTimeDayLVAdapter extends BaseAdapter {

    private Context mContext;
    private List<String> mList;


    private TextView tv_day;
    private int now_position;

    public SelectTimeDayLVAdapter(Context mContext, List<String> mList) {
        this.mContext = mContext;
        this.mList = mList;

    }

    public void setOnItme(int position) {
        now_position=position;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return i;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(final int i, View view, ViewGroup viewGroup) {
        view = View.inflate(mContext, R.layout.item_day, null);
        tv_day = view.findViewById(R.id.tv_day);

        tv_day.setText(mList.get(i));

        if (i == now_position) {
            tv_day.setBackgroundColor(mContext.getResources().getColor(R.color.color_FFFFFF));
        } else {
            tv_day.setBackgroundColor(mContext.getResources().getColor(R.color.color_F5F5F5));
        }

        return view;
    }
}
